package com.woniu.car.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.car.domain.TPermission;
import com.woniu.car.mapper.TPermissionMapper;
import com.woniu.car.service.TPermissionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author WWX
 * @since 2021-06-19
 */
@Service
public class TPermissionServiceImpl extends ServiceImpl<TPermissionMapper, TPermission> implements TPermissionService {
    /**
     *@Author 王维鑫
     *@Description 查看权限列表
     *@Param
     *@return
     **/
    @Override
    @Transactional
    public List<TPermission> showPermission() {
        List<TPermission> list = this.list();
        return list;
    }
    /**
     *@Author 王维鑫
     *@Description 新增权限
     *@Param
     *@return
     **/
    @Override
    @Transactional
    public void insertPermission(TPermission tPermission) throws Exception {
        boolean save = this.save(tPermission);
        if(save==false){
            throw new Exception("新增权限失败");
        }
    }
    /**
     *@Author 王维鑫
     *@Description 修改权限
     *@Param
     *@return
     **/
    @Override
    @Transactional
    public void updatePermission(TPermission tPermission) throws Exception {
        boolean b = this.updateById(tPermission);
        if(b==false){
            throw new Exception("权限修改失败");
        }
    }
}
